<?PHP
 session_start();
 include("admin/include/db.php");
 include("includes/function.php");


  if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'contact_us'){
	

	$user_email 		= mysql_real_escape_string($_REQUEST['user_email']);
	$user_subject 		= mysql_real_escape_string($_REQUEST['user_subject']);
	$user_mobile 		= mysql_real_escape_string($_REQUEST['user_mobile']);
	$user_description 	= mysql_real_escape_string($_REQUEST['user_description']);
	$subject			= 'Inquiry about Softwarecourseonline.com';
	$emailMessage = '
						<style type="text/css">
							.text {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }						
						</style>
						<table width="100%" cellpadding="2" cellspacing="2" class="text">																	
							<tr>
								<td colspan="2" align="left">&nbsp;</td>
							</tr>
							<tr>
								<td colspan="2" align="left">Contact Us</td>
							</tr>
							<tr>
								<td colspan="2" align="left" style="padding-top:10px">Please check more detail</td>
							</tr>
							<tr>
								<td colspan="2" align="left" style="padding-top:10px">Email: '.$user_email.'</td>
							</tr>
							<tr>
								<td colspan="2" align="left" style="padding-top:10px">Subject: '.$user_subject.'</td>
							</tr>
							<tr>
								<td colspan="2" align="left" style="padding-top:10px">Mobile: '.$user_mobile.'</td>
							</tr>
							<tr>
								<td colspan="2" align="left" style="padding-top:10px">Description: '.$user_description.'</td>
							</tr>
							<tr>
								<td colspan="2" align="left" style="padding-top:10px">&nbsp;</td>
							</tr>
						</table>';
						
		emailFormat(TO , FROM , $subject , $emailMessage);
		header("location:contact_us.php?msg=1");
		exit();	
	}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=TITLE_WEBSITE?></title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<script>s
function contactus_validation(){
	
	var message = '';
	var emailReg	  	  = document.getElementById("user_email").value;
	var user_subject	  = document.getElementById("user_subject").value;
	var user_mobile	  	  = document.getElementById("user_mobile").value;
	var user_description  = document.getElementById("user_description").value;
	
	if(emailReg == ''){
		message += 'Please enter email address \n';	
	}
	
	if(emailReg != ""){
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    	var address = emailReg;
    	if(reg.test(address) == false) {
 			message += 'Please enter valid email address\n';
      	}
	}
	
	if(user_subject == ''){
		message += 'Please enter valid email address\n';
	}
	
	if(user_mobile == ''){
		message += 'Please enter valid mobile number\n';
	}
	if(user_description == ''){
		message += 'Please enter your description\n';
	}
	
	if(message != ""){
		alert(message);
		return false;	
	}
}


</script>
<body>
<center>
<div style="background:#179cc1; height:3px">&nbsp;</div>
<div style="width:990px;" align="center">
		<div id="header">
		<?php
    		include("includes/header.php");
   		?>
        </div>
        <div style="margin-top:23px; margin-bottom:21px" align="center" >
    	<?php
									$sqlAdvertise = mysql_query("SELECT * FROM software_advertise 
																	WHERE 
																		banner_status = 'Y' AND banner = 2
																		ORDER BY RAND()
																		");
									$resAdvertise = mysql_fetch_array($sqlAdvertise);
							
									$imgPath  = 'admin/upload_images/'.$resAdvertise["banner_image"];
									
								?>
						
    </div>
    <div style="margin-top:20px;">
        <form id="form_contactus" name="form_contactus" method="post" onsubmit="return contactus_validation()" >
        <div style="float:left; width:65%;" >
        	<div align="left" >
            	<span class="headingOrange" ><strong>Contact Us</strong></span>
            </div>
            <div class="text1"  align="left" style=" padding-top:18px;">
         		 <div  >	
                    <div style="float:left; width:35%; padding-left:30px" class="text" align="left" >Email:</div>
                    <div style="float:left; width:60%" ><input type="text" id="user_email" class="textBox" name="user_email" value="" maxlength="30"  /> </div>
                    <div style=" clear:both" ></div>
                </div>
                <div style=" margin-top:10px;" >	
                    <div style="float:left; width:35%;padding-left:30px" class="text" align="left" > Name:</div>
                    <div style="float:left; width:60%" ><input type="text" id="user_name" class="textBox" name="user_name" value="" maxlength="30"  /> </div>
                    <div style=" clear:both" ></div>
                </div>
                 <div style=" margin-top:10px;"  >	
                    <div style="float:left;  width:35%; padding-left:30px" class="text" align="left" > Mobile:</div>
                    <div style="float:left; width:60%" ><input type="text" id="user_mobile" class="textBox" name="user_mobile" value="" maxlength="30"  /> </div>
                    <div style=" clear:both" ></div>
                </div>
                	 <div style=" margin-top:10px;"  >	
                    <div style="float:left;  width:35%; padding-left:30px" class="text" align="left" >Subject:</div>
                    <div style="float:left; width:60%" ><input type="text" id="user_subject" class="textBox" name="user_subject" value="" maxlength="30"  /> </div>
                    <div style=" clear:both" ></div>
                </div>
                	 <div style=" margin-top:10px;"  >	
                    <div style="float:left;  width:35%; padding-left:30px" class="text" align="left" >Description:</div>
                    <div style="float:left; width:60%" >
                    <textarea id="user_description" name="user_description" rows="10" cols="40"  ></textarea>
                     </div>
                    <div style=" clear:both" ></div>
                </div>
                <div style="margin-top:20px; padding-right:50px" align="center">	
                 	<input type="hidden" id="action" name="action" value="contact_us"  />
                   	<input type="submit" class="button" value="Contact Us"  />
                </div>
                 
            </div>
        </div>
        </form>
        <div style="float:left" align="right">
        	<?php
									$sqlAdvertise = mysql_query("SELECT * FROM software_advertise 
																	WHERE 
																		banner_status = 'Y' AND banner = 3
																		ORDER BY RAND()
																		");
									$resAdvertise = mysql_fetch_array($sqlAdvertise);
							
									$imgPath  = 'admin/upload_images/'.$resAdvertise["banner_image"];
									
								?>
								
        </div>
      <div style="clear:both"></div>
    </div>
    
    <div style="margin-top:23px; margin-bottom:21px" align="center" >
    	<?php
									$sqlAdvertise = mysql_query("SELECT * FROM software_advertise 
																	WHERE 
																		banner_status = 'Y' AND banner = 2
																		ORDER BY RAND()
																		");
									$resAdvertise = mysql_fetch_array($sqlAdvertise);
							
									$imgPath  = 'admin/upload_images/'.$resAdvertise["banner_image"];
									
								?>
					
    </div>
   </div>
   <div id="footer">
  		<?php include("includes/footer.php")?>
   </div>
</div>
	</div>
</center>
</body>
</html>
